/*
 * SongTableModel.java
 *
 * Created on June 20, 2005, 1:58 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */
package com.bff.slimserver.musicjukebox.lib;

import com.bff.bjj.utils.Resources;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.swing.table.*;
import org.bff.slimserver.musicobjects.SlimSong;

/**
 *
 * @author Bill Findeisen
 */
public abstract class SongTableModel extends AbstractTableModel {

    protected List<SlimSong> dataList;
    protected JukeboxProperties jp;

    public SongTableModel(Collection<SlimSong> songs) {
        jp = JukeboxProperties.getInstance();
        dataList = new ArrayList<SlimSong>(songs);
    }

    public abstract int getArtistColumnIndex();

    public abstract int getAlbumColumnIndex();

    public abstract int getTitleColumnIndex();

    public abstract int getLengthColumnIndex();

    public abstract int getTrackColumnIndex();

    public abstract int getYearColumnIndex();

    public abstract int getBitrateColumnIndex();
    //public abstract int getGenreColumnIndex();

    public abstract int getSortColumn();

    public static String getHeader(Resources.LABEL_KEY key) {
        return Resources.getMessage(key);
    }

    public String getSongTitle(SlimSong song) {
        return song.getTitle();
    }

    public String getArtistTitle(SlimSong song) {
        return song.getArtist();
    }

    public String getAlbumTitle(SlimSong song) {
        return song.getAlbum().getName();
    }

    public SlimSong getSong(int row) {
        return (dataList.get(row));
    }
}
